//
//  ModifyViewController.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/3.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class ModifyViewController: UIViewController {

    var phoneImageView : UIImageView!
    var phoneTextField : UITextField!
    
    var bgView:UIView!
    
    var PasswordImageView : UIImageView!
    var PasswordTextField : UITextField!
    
    var bgView1:UIView!
    
    var verificationImageView : UIImageView!
    var verificationTextField : UITextField!
    
    var bgView2:UIView!
    
    
    var SureButton : UIButton!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = bgGrayColor;
        navigationItem.title="修改密码"
        //手机号
        
        phoneImageView = UIImageView(image: UIImage(named: "Password"))
        
        self.view.addSubview(phoneImageView)
        
        
        phoneTextField = UITextField()
        //设置边框样式为圆角矩形
        phoneTextField.borderStyle = UITextBorderStyle.none
        phoneTextField.placeholder = "原密码"
        self.view.addSubview(phoneTextField)
        
        
        
        bgView = UIView()
        bgView.backgroundColor = UIColor.gray
        self.view.addSubview(bgView)
        
        
        
        //密码
        
        
        PasswordImageView = UIImageView(image: UIImage(named: "Password"))
        
        self.view.addSubview(PasswordImageView)
        
        
        PasswordTextField = UITextField()
        //设置边框样式为圆角矩形
        PasswordTextField.borderStyle = UITextBorderStyle.none
        PasswordTextField.placeholder = "再次输入密码"
        self.view.addSubview(PasswordTextField)
        
        bgView1 = UIView()
        bgView1.backgroundColor = UIColor.gray
        self.view.addSubview(bgView1)
        
        
        SureButton = UIButton()
        //背景颜色
        SureButton.backgroundColor = UIColor.blue
        SureButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        SureButton.setTitle("确定", for: .normal )
        SureButton.layer.cornerRadius = 10
        SureButton.layer.masksToBounds = true
        
        SureButton.addTarget(self,action:#selector(SureButtonClick), for: .touchUpInside)
        self.view.addSubview(SureButton)
        

        self.layoutView()
    }
    @objc func SureButtonClick() {
        print("确定")
    }

    func layoutView() {
        
        self.phoneImageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.snp.top).offset(110)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
        
        self.phoneTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.snp.top).offset(100)
            make.left.equalTo(self.phoneImageView.snp.right).offset(5)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        self.bgView.snp.makeConstraints { (make) in
            make.top.equalTo(self.phoneTextField.snp.bottom).offset(5)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(1)
        }
        
        
        self.PasswordImageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.bottom).offset(15)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
        
        self.PasswordTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.bottom).offset(5)
            make.left.equalTo(self.PasswordImageView.snp.right).offset(5)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        self.bgView1.snp.makeConstraints { (make) in
            make.top.equalTo(self.PasswordTextField.snp.bottom).offset(5)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(1)
        }
        
        
        self.SureButton.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView1.snp.bottom).offset(20)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(40)
        }
   
    }

}
